#include <ros/ros.h>
#include "turtlesim/Pose.h"//包含Pose数据类型
void poseCallback(const turtlesim::Pose::ConstPtr& msg);

void poseCallback(const turtlesim::Pose::ConstPtr& msg){
    //将接收到的信息打印出来
    ROS_INFO("Turtle pose x:%0.6f,y:%0.6f",msg->x,msg->y);

}

int main(int argc,char **argv){
    //初始化ROS节点
    ros::init(argc,argv,"pose_subscriber");
    //创建节点句柄
    ros::NodeHandle n;
    //注册一个Subscriber
    ros::Subscriber pose_sub = n.subscribe("/turtle1/pose",10,poseCallback);

    //循环等待回调函数

    ros::spin();

    return 0;

}

